﻿<%@ Page Language="C#" MasterPageFile="~/Org/MasterPage.master" AutoEventWireup="true"
    EnableEventValidation="false" ValidateRequest="false" CodeFile="frmO_EmpEnterInput.aspx.cs"
    Inherits="Org_frmO_EmpEnterInput" Culture="ja-JP" UICulture="ja" Title="入退社情報登録" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    入退社情報登録
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
 
  
    <script type="text/javascript" language="javascript" src="../js/jquery.min.js"></script>
    <script language="javascript" type="text/javascript" src="../js/Validation.js"></script>
    <script language="javascript" type="text/javascript" src="../js/jquery.maxlength.js"></script>
    <script type="text/javascript" language="javascript" src="../js/jquery.maskedinput.js"></script>

    <script type="text/javascript" language="javascript">
    
        $(document).ready(function() {

            $('#<%=txt_入社特記事項.ClientID %>').maxlength({
                events: [], // Array of events to be triggerd    
                maxCharacters: 1000, // Characters limit   
                status: false, // True to show status indicator bewlow the element    
                showAlert: false, // True to show a regular alert message    
                slider: false // True Use counter slider    
            });

            $('#<%=txt_退社特記事項.ClientID %>').maxlength({
                events: [], // Array of events to be triggerd    
                maxCharacters: 1000, // Characters limit   
                status: false, // True to show status indicator bewlow the element    
                showAlert: false, // True to show a regular alert message    
                slider: false // True Use counter slider    
            });


            registerEnterEvent("enter", "<%= btn登録.ClientID %>", 6);
            registerControlToValidation("validation");
            formatDate("css_text_calender", "/");

        });

        function checkExistNull(src, args) {

            var txt1 = $('#<%=txt_退社年月日.ClientID %>').val();
            if ((txt1 != "")) {
                if (args.Value == "")
                    args.IsValid = false;
                else
                    args.IsValid = true;
            }
        }

        function checkNull新規(source, args) {
            var text = $('#<%= ddl_採用区分.ClientID %> option:selected').val();
            if (text == "1" || text == "0") {
                if (args.Value == "")
                    args.IsValid = false;
                else
                    args.IsValid = true;
            }
        }

        function CheckDateIsValid(source, args) {
            var text = $('#<%= ddl_採用区分.ClientID %> option:selected').val();
            if (text == "0") {
                if (args.Value != "") {
                    ValidatorEnable2(document.getElementById("<%= CustomValidator1.ClientID %>"), true);
                }
            }
        }

        //Date: 21.02.2012
        function CheckDate即戦力IsValid(source, args) {
            var text = $('#<%=txt_退社年月日.ClientID %>').val();
            if (text != "") {
                if (args.Value != "") {
                    ValidatorEnable2(document.getElementById("<%= CustomValidator1.ClientID %>"), true);
                }
            }

        }

        function CheckNull_ddl退職理由(oSrc, args) {
            var text = $('#<%=txt_退社年月日.ClientID %>').val();

            if (text != "" && args.Value == "-1") {
                args.IsValid = false;
            }
            else {
                args.IsValid = true;

            }
        }

        function checkNull即戦力(source, args) {
            var text = $('#<%= ddl_採用区分.ClientID %> option:selected').val();
            if (text == "0") {
                if (args.Value == "")
                    args.IsValid = false;
                else
                    args.IsValid = true;
            }
        }

        // so sanh voi ngay thang hien tai
        function checkLessThanNowDate(source, args) {
            args.IsValid = checkYearOld(args.Value, getNowDate(new Date()), 0, "<");
        }
        
        function CompareDate(src, args) {

            var date_start = $('input[id$=入社年月日]').val();
            args.IsValid = checkYearOld(date_start, args.Value, 0, "<");
           
        }
        function afunc(oSrc, args) {
            args.IsValid = false;
        }

    </script>

    <input type="hidden" id="Flag" />
    <div class="maindiv1">
      <link href="../Style/Style.css" rel="stylesheet" type="text/css" />
        <div class="Header1">
            ＊: 必須. <span style="margin-left: 70%;"></span>
        </div>
        <div class="NoteStyle">
            <span>※下記の情報があれば、必須項目を入力してください。なければ、次ボタンを押してください。 </span>
            <div>
                &nbsp;</div>
        </div>
        <div class="detail-admin-row">
            <span class="detail-admin-label">採用区分 :</span>
            <asp:DropDownList ID="ddl_採用区分" runat="server"  Font-Names="MS UI Gothic"
                ValidationGroup="detailForm" CssClass="enter validation dropdownlist width2">
                <asp:ListItem Value="-1" Selected="True">[選択]</asp:ListItem>
                <asp:ListItem Value="1">新規</asp:ListItem>
                <asp:ListItem Value="0">即戦力（途中）</asp:ListItem>
            </asp:DropDownList>
            <span class="required-field">*</span>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage=""
                Display="None" InitialValue="-1" ControlToValidate="ddl_採用区分" SetFocusOnError="False"></asp:RequiredFieldValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender7" Width="260px"
                TargetControlID="RequiredFieldValidator3" HighlightCssClass="invalid" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />
        </div>
        <div class="detail-admin-row">
            <span class="detail-admin-label">入社年月日 :</span>
            <asp:TextBox ID="txt_入社年月日"  runat="server" Font-Names="MS UI Gothic"
                onkeypress="return InputNumberKeys(this, event)" ValidationGroup="detailForm"
                Style="ime-mode: disabled" CssClass="enter css_text_calender validation textbox width_calendar"></asp:TextBox>
            <asp:ImageButton ID="ImageButton1_1" runat="server" ImageUrl="../Images/calendar.jpg"
                Height="16px" CssClass="cal_Img" CausesValidation="False" ValidationGroup="detailform" />
            <span class="required-field">*</span>
            <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txt_入社年月日"
                PopupButtonID="ImageButton1_1" PopupPosition="BottomRight" Format="yyyy/MM/dd">
            </ajaxToolkit:CalendarExtender>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage=""
                Display="None" ControlToValidate="txt_入社年月日" SetFocusOnError="False"></asp:RequiredFieldValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender8" Width="260px"
                TargetControlID="RequiredFieldValidator1" HighlightCssClass="invalid" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />
            <asp:CustomValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="CustomValidator"
                ControlToValidate="txt_入社年月日" Display="None" SetFocusOnError="false" ClientValidationFunction="isDate"></asp:CustomValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender11" Width="240px"
                TargetControlID="RegularExpressionValidator1" HighlightCssClass="invalid1" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />

            <asp:CustomValidator ID="CustomValidator5" runat="server" ErrorMessage="Compare"
                Display="None" SetFocusOnError="false" ControlToValidate="txt_入社年月日" ValidateEmptyText="true"
                ClientValidationFunction="CheckDate即戦力IsValid"></asp:CustomValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender6" Width="260px"
                TargetControlID="CustomValidator5" HighlightCssClass="invalid2" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />
            <asp:CustomValidator ID="CustomValidator6" runat="server" ErrorMessage="Compare"
                Display="None" SetFocusOnError="false" ControlToValidate="txt_入社年月日" ValidateEmptyText="true"
                ClientValidationFunction="checkLessThanNowDate"></asp:CustomValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender4" Width="240px"
                TargetControlID="CustomValidator6" HighlightCssClass="invalid2" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />    
        </div>
        <div class="detail-admin-row">
            <span class="detail-admin-label">入社特記事項 :</span>
            <asp:TextBox ID="txt_入社特記事項" runat="server" ValidationGroup="detailForm" CssClass="textarea enter"
                TextMode="MultiLine" Font-Names="MS UI Gothic" MaxLength="1000"></asp:TextBox>
        </div>
        <div class="detail-admin-row">
            <span class="detail-admin-label">退社年月日 :</span>
            <asp:TextBox ID="txt_退社年月日" runat="server" Font-Names="MS UI Gothic"
                onkeypress="return InputNumberKeys(this, event)" ValidationGroup="detailForm"
                Style="ime-mode: disabled" CssClass="enter css_text_calender validation textbox width_calendar"></asp:TextBox>
            <asp:ImageButton ID="ImageButton1_2" runat="server" ImageUrl="../Images/calendar.jpg"
                Height="16px" CssClass="cal_Img" CausesValidation="False" ValidationGroup="detailform" />
            <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txt_退社年月日"
                PopupButtonID="ImageButton1_2" PopupPosition="BottomRight" Format="yyyy/MM/dd">
            </ajaxToolkit:CalendarExtender>
            
            <asp:CustomValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="CustomValidator"
                ControlToValidate="txt_退社年月日" Display="None" SetFocusOnError="false" ClientValidationFunction="isDate"></asp:CustomValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender1" Width="260px"
                TargetControlID="RegularExpressionValidator2" HighlightCssClass="invalid1" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Compare"
                Display="None" SetFocusOnError="false" ControlToValidate="txt_退社年月日" ClientValidationFunction="CompareDate"></asp:CustomValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender2" Width="260px"
                TargetControlID="CustomValidator1" HighlightCssClass="invalid2" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />
            <asp:CustomValidator ID="CustomValidator4" runat="server" ErrorMessage="Compare"
                Display="None" SetFocusOnError="false" ValidateEmptyText="true" ControlToValidate="txt_退社年月日"
                ClientValidationFunction="checkNull即戦力"></asp:CustomValidator>
            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender5" Width="260px"
                TargetControlID="CustomValidator4" HighlightCssClass="invalid3" CssClass="CustomValidatorCalloutStyle"
                WarningIconImageUrl="../Images/warning.png" />
        </div>
        <div class="detail-admin-row">
            <span class="detail-admin-label">退社特記事項 :</span>
            <asp:TextBox ID="txt_退社特記事項" runat="server" ValidationGroup="detailForm" CssClass="textarea enter"
                TextMode="MultiLine" Font-Names="MS UI Gothic" MaxLength="1000"></asp:TextBox>
            <div class="detail-admin-row">
                <span class="detail-admin-label">退職理由 :</span>
                <asp:DropDownList ID="ddl_退職理由" runat="server"  Font-Names="MS UI Gothic"
                    ValidationGroup="detailForm" CssClass="enter validation dropdownlist width2">
                    <asp:ListItem Value="-1" Selected="True">[選択]</asp:ListItem>
                    <asp:ListItem Value="0">定年</asp:ListItem>
                    <asp:ListItem Value="1">契約満了</asp:ListItem>
                    <asp:ListItem Value="2">自己都合</asp:ListItem>
                    <asp:ListItem Value="3">会社都合</asp:ListItem>
                    <asp:ListItem Value="4">失踪</asp:ListItem>
                    <asp:ListItem Value="4">死亡</asp:ListItem>
                    <asp:ListItem Value="5">その他</asp:ListItem>
                </asp:DropDownList>
                
                <asp:CustomValidator ID="cusVal" runat="server" ErrorMessage="asd" Display="None"
                    ClientValidationFunction="CheckNull_ddl退職理由" ControlToValidate="ddl_退職理由"></asp:CustomValidator>
                <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender3" Width="260px"
                    TargetControlID="cusVal" HighlightCssClass="invalid" CssClass="CustomValidatorCalloutStyle"
                    WarningIconImageUrl="../Images/warning.png" />
            </div>

            
            <div class="detail-admin-row">
                <span class="detail-admin-label">&nbsp;</span>
                <asp:Button ID="btn登録" runat="server" Text="登録" CssClass="btn" 
                    OnClientClick="javascript:focusToControlErr();" onclick="btn登録_Click"
                     />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnリセット" runat="server" Text="リセット" CssClass="btn" CausesValidation="False"
                    OnClick="btnリセット_Click" />
            </div>
            <div class="headerLineAndGray">
                ＊: 入退社情報 一覧
            </div>
            <asp:HiddenField ID="hd_pageCount" runat="server"></asp:HiddenField>
            <div style="margin: 10px 50px 50px" class="detail-admin-row">
                <asp:GridView ID="grv_human" runat="server" AutoGenerateColumns="False" AllowPaging="true"
                    DataKeyNames="ID" PageSize="10" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
                    GridLines="Vertical" Height="40px" Width="100%" CssClass="mGrid" OnPageIndexChanging="grv_human_PageIndexChanging"
                    Font-Names="MS UI Gothic"  OnRowDataBound="grv_human_RowDataBound"
                    OnPreRender="grv_human_PreRender" onrowcommand="grv_human_RowCommand">
                    <Columns>
                        <%--<asp:BoundField HeaderText="採用区分" DataField="採用区分_1" />--%>
                        <asp:TemplateField HeaderText="採用区分" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="140px">
                            <ItemTemplate>
                                <asp:Label ID="lbl_採用区分" runat="server" Text='<%# formatStyle1(Eval("採用区分")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="入社年月日" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="140px">
                            <ItemTemplate>
                                <asp:Label ID="lbl_入社年月日" runat="server" Text='<%# Eval("入社年月日","{0:yyyy年MM月dd日}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="退社年月日" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="140px">
                            <ItemTemplate>
                                <asp:Label ID="lbl_退社年月日" runat="server" Text='<%# Eval("退社年月日","{0:yyyy年MM月dd日}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <%--<asp:BoundField HeaderText="生年月日" />--%>
                        <%--<asp:BoundField HeaderText="退職理由" DataField="退職理由" />--%>
                        <asp:TemplateField HeaderText="退職理由" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                            <ItemTemplate>
                                <asp:Label ID="lbl_退職理由" runat="server" Text='<%# Format( Eval("退職理由")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
        <div class="detail-admin-row">
            <div class="btn_back">
                <asp:Button ID="btn_戻る" runat="server" Text="←戻る" CausesValidation="false" OnClick="btn_戻る_Click"
                    CssClass="btn" />
            </div>
            <div class="btn_next">
                <asp:Button ID="btn_次" runat="server" Text="次→" CausesValidation="false" OnClick="btn_次_Click"
                    CssClass="btn" />
            </div>
            <div>
            <br />
            </div>
            <br />
        </div>
    </div>
</asp:Content>
